/******************************************************************************
 **
 **    LISA Confidential
 **
 **    Source Materials
 **
 **    (C) COPYRIGHT LISA 2008-2009
 **
 **
 **  File Name:      WorkflowManager.java
 **  Description:
 **  Date:           2008-10-28
 **  Author:         LisaQian
 ******************************************************************************/
package com.ti.andon.workflow;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.jbpm.JbpmContext;
import org.jbpm.graph.def.Transition;
import org.jbpm.taskmgmt.exe.TaskInstance;

public interface WorkflowManager
{
    public JbpmContext getContext();
    
	public abstract void setContext(JbpmContext context);
	
	public abstract Long creatProcessInstance(Long drafterID, String processDefinitionName,
			String businessKey, String transition, Long department, Date draftTime) throws Exception;

	public void updateProcessInstance(Long processID, Long actorId, String transitionName, Long department) throws Exception;

	public void updateProcessInstance(String processName, String businessKey, Long actorId, String transitionName,
					Long department) throws Exception;
	
	public abstract boolean cancelProcessInstance(String businessKey,
			String processDefinitionName, Long actorId, String comment) throws Exception;

	public abstract List getTaskList(Long userID);

	public abstract List getTaskListByActorIdProcDefName(Long actorId, String processDefinitionName);
	
	public abstract String transProcessInstance(TaskInstance taskInstance,
			String transition, Long nextActorId, Long actorId,
			String comment) throws Exception;

	public abstract String transProcessInstance(String businessKey, String processDefinitionName,
			String transitionName, Long actorId, String comment) throws Exception;

	public abstract Collection getCurrentTaskInstances(String businessKey,
			String processDefinition);

	public abstract List getTaskListForOneTask(Long actorId,
			boolean includeVariables, String taskName);
	
	public abstract List getTransitionsCommand(TaskInstance taskInstance) throws Exception;
	
	public abstract List getProcessedProcess(String processDefinition, Long processer, String startTime,
			String endTime) throws Exception;	
	
	public abstract TaskInstance getCurrentTaskInstanceForOneUser(
			String businessKey, String processDefinitionName, Long actorId)
			throws Exception;	
	
	public Transition getTransitionsForWithdraw(TaskInstance taskInstance);	
	
	public TaskInstance getPooledTaskInstancesCommand(Long pooledActorId, String businessKey,
			String processDefinition, String taskName);
	
	public List getCandidateUsers4Transition(TaskInstance taskInstance, Transition transition) throws Exception;
	
	public abstract String getJointApprovementDepName(TaskInstance taskInstance,
			Transition transition) throws Exception;
	
	public abstract void deployProcess() throws Exception;
	
	public String decideForVPAppr(TaskInstance taskInstance) throws Exception;
	
}
